import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86156
 * Date: 2023-04-08
 * Time: 21:03
 */

// public int length(); 返回此字符串的长度
// 数组的长度 数组名.length
// 字符串的长度 字符串名.length
// public char charAt(); 根据索引返回字符

public class Test {
    public static void main(String[] args) {
        String str = "HelloWorld";
        char[] chs = {'a','b','c'};
        String str1 = arrToString(chs);
        System.out.println(str1);
        System.out.println(reverser(str));
    }

    // 遍历字符串
    public static void ergodicString(String str){
        for (int i = 0; i < str.length(); i++) {
            System.out.print(str.charAt(i)+" ");
        }
    }

    // 字符串翻转
    public static String reverser(String str){
        String result = "";
        for (int i = str.length()-1; i >= 0; i--) {
           result = result+str.charAt(i);
        }
        return result;
    }

// 数组转字符串
    public static String arrToString(char[] arr){
        if(arr==null){
            return "";
        }

        if(arr.length == 0){
            return "[]";
        }

        String result = "[";
        for (int i = 0; i < arr.length; i++) {
            if(i!=arr.length-1){
               result = result+arr[i]+",";
            }else{
                result = result+arr[i]+"]";
            }
        }
        return result;
    }
}


// 键盘录入字符串,统计数字符号,大写字母,小写字母个数
class Test3{
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.next();

        int bigCount = 0;
        int smallCount = 0;
        int numCount = 0;

        for (int i = 0; i < str.length(); i++) {
            char c = str.charAt(i);

            if(c>='a'&& c<='z'){
                smallCount++;
            } else if (c>='A'&& c<= 'Z') {
                bigCount++;
            }else if(c>= '0' && c<='9'){
                numCount++;
            }
        }
    }
}


class Test4{
    public static void main(String[] args) {
       String str1 = "abcde";
       String str2 = "cdeab";
       boolean rotate = rotate(str1,str2);
        System.out.println(rotate);
        boolean rotate2 = rotate(str1,str2);
        System.out.println(rotate2);

    }
    public static boolean rotate(String str1, String str2){
        int count = str1.length();
        while(count!=0){
            char ch =  str1.charAt(0);
            str1 = str1.substring(1);
            str1 = str1+ch;

            if(str1.equals(str2)){
                return true;
            }
            count--;
        }
        return false;
    }

    public static boolean rotate2(String str1,String str2){
        int count = str1.length();
        while (count!=0) {
            char[] chars = str1.toCharArray();
            char tmp = chars[0];
            for (int i = 1; i < chars.length; i++) {
                chars[i-1] = chars[i];
            }
            chars[chars.length-1] = tmp;
            String s = new String(chars);
            str1 = s;
            count--;
            if(str1.equals(str2)){
                return true;
            }
        }
        return false;
    }
}